package com.twu.biblioteca;

/**
 * Created with IntelliJ IDEA.
 * User: tcz
 * Date: 13-7-5
 * Time: 下午11:55
 */
public class User {
    private String username;
    private String password;
    private UserInfo userInfo;

    User(String username, String password) {
        if (verifyUsernameFormat(username)) {
            this.username = username;
            this.password = password;
        }
    }

    boolean verifyUsernameFormat(String username) {
        return username.matches("\\d{3}-\\d{4}");
    }

    public class UserInfo {
        private String name;
        private String email;
        private String address;
        private String phoneNumber;

        @Override
        public String toString() {
            return name + email + address + phoneNumber;
        }
    }

    public String getUsername() {
        return username;
    }

    public String getPassword() {
        return password;
    }

    public UserInfo getUserInfo() {
        return userInfo;
    }
}
